<template>
	<view class="login-container">
		<!-- 微信登录按钮 -->
		<u-button :custom-style="buttonStyle" type="success" text="微信登录" icon="weixin-fill" icon-color="#ffffff"
			@click="wxLogin"></u-button>
	</view>
</template>

<script setup>
	import {
		onMounted,
		ref
	} from 'vue';
	import {
		loginRequest,
		debugLoginRequest
	} from '@/request/login.js'

	import {
		onShow,
		onLoad
	} from '@dcloudio/uni-app'

	import {
		goToInternalPage
	} from '@/utils/jump.js'

	import {
		 wxJsCodeLogin
	} from '@/utils/buzlogin.js'
	
	// 页面生命周期（uni-app）
	onLoad(() => {
		console.log('登录页面加载中')
	})
	//微信登录
	const wxLogin = () => {
		
	    wxJsCodeLogin()
		    .then((loginType)=>{
				goToInternalPage("usercenter/index")
				
			}).catch((err) => {
			   uni.showToast({
			   	title: err,
			   	icon: 'none'
			   })
		   });
	}
</script>

<style>
	.login-container {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 100vh;
		background-color: #ffffff;
	}
</style>